package com.changgou.search.pojo;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * 1.创建索引
 * 2.创建类型
 * 3.创建文档 ()
 * 4.字段的映射(是否分词 是否索引 是否存储  数据类型是什么 分词器是什么)
 *
 * @author www.itheima.com
 * @version 1.0
 * @Document(indexName = "skuinfo",type = "docs")
 * indexName 指定创建的索引的名称
 * type :指定索引中的类型
 * @package PACKAGE_NAME *
 * @since 1.0
 */

@Document(indexName = "skuinfo", type = "docs")
public class SkuInfo implements Serializable {


	//@id 表示文档的唯一标识
	@Id
	private Long id;

	//SKU名称
	// @Field 字段的映射
	// analyzer 指定索引的是用的分词分词器   searchAnalyzer :搜索的时候使用的分词器
	// type 指定数据类型
	@Field(type = FieldType.Text, analyzer = "ik_smart")
	private String name;

	//商品价格，单位为：元
	@Field(type = FieldType.Double)
	private Long price;

	//库存数量

	private Integer num;

	//商品图片
	//@Field(index = false)
	private String image;

	//商品状态，1-正常，2-下架，3-删除
	private String status;

	//创建时间
	private Date createTime;

	//更新时间
	private Date updateTime;

	//是否默认
	private String isDefault;

	//SPUID
	private Long spuId;

	//类目ID
	private Long categoryId;

	//类目名称
	// FieldType.Keyword 是一个关键字 (keyword) 表示不分词.
	@Field(type = FieldType.Keyword)
	private String categoryName;

	//品牌名称
	@Field(type = FieldType.Keyword)
	private String brandName;

	//规格
	private String spec;

	//动态的域的添加和变化

	//规格参数
	//@Field(type = FieldType.Object)
	private Map<String, Object> specMap;


	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getPrice() {
		return price;
	}

	public void setPrice(Long price) {
		this.price = price;
	}

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(String isDefault) {
		this.isDefault = isDefault;
	}

	public Long getSpuId() {
		return spuId;
	}

	public void setSpuId(Long spuId) {
		this.spuId = spuId;
	}

	public Long getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public String getBrandName() {
		return brandName;
	}

	public void setBrandName(String brandName) {
		this.brandName = brandName;
	}

	public String getSpec() {
		return spec;
	}

	public void setSpec(String spec) {
		this.spec = spec;
	}

	public Map<String, Object> getSpecMap() {
		return specMap;
	}

	public void setSpecMap(Map<String, Object> specMap) {
		this.specMap = specMap;
	}
}
